package com.xn.app.muying.adpter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.xn.app.muying.R;
import com.xn.app.muying.bean.SheetExceptionBean;
import com.xn.app.muying.bean.SheetException_two;
import com.xn.app.muying.bean.UnfinishSheetBean;

import java.util.ArrayList;

public class SheetExceptionInfoAdapter extends BaseAdapter {
    private final LayoutInflater inflater;
    private Context context;
    private ArrayList<SheetException_two> list = new ArrayList();

    public SheetExceptionInfoAdapter(Context context) {
        super();
        this.context = context;
        inflater = LayoutInflater.from(context);
    }

    public void getData(ArrayList<SheetException_two> data) {
        this.list = data;
        notifyDataSetChanged();
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int i) {
        return list.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        ViewHolder holder = null;
        if (view == null) {
            view = inflater.inflate(R.layout.sheetexceptioninfo_item, null);
            holder = new ViewHolder();
            holder.name = (TextView) view.findViewById(R.id.sheetexceptioninfo_name);
            holder.status = (TextView) view.findViewById(R.id.sheetexceptioninfo_status);
            view.setTag(holder);
        } else {
            holder = (ViewHolder) view.getTag();
        }
        holder.name.setText(list.get(i).getChineseName());
        holder.status.setText(list.get(i).getStatusDescription());
        return view;
    }

    class ViewHolder {
        TextView name, status;
    }
}
